package com.jdyinfo.ic.config;

import java.util.concurrent.TimeUnit;

import org.springframework.context.annotation.Configuration;

import okhttp3.OkHttpClient;

@Configuration
public class OkHttpClientBuilder {
	public static OkHttpClient build(long connectTimeout, long readTimeout, long writeTimeout) {
		OkHttpClient.Builder builder = new OkHttpClient.Builder();
		builder.connectTimeout(connectTimeout,TimeUnit.SECONDS)
			.readTimeout(readTimeout,TimeUnit.SECONDS)
			.writeTimeout(writeTimeout,TimeUnit.SECONDS)
			.retryOnConnectionFailure(true);
		return builder.build();
	}
}
